#ifndef RESERVEHOME_H
#define RESERVEHOME_H

#include <QWidget>
#include <QTime>
#include <enteryandout.h>

struct seat{
    QString name;
    bool isUnbooked;
};
struct area{
    QString name;
    int seatNum;
    seat *s;
};
struct floor{
    QString name;
    int areaNum;
    area *a;
};
struct campus{
    QString name;
    int floorNum;
    floor *f;
};
namespace Ui {
class reserveHome;
}

class reserveHome : public QWidget
{
    Q_OBJECT

public:
    explicit reserveHome(QWidget *parent = nullptr);
    ~reserveHome();

private slots:
    void on_pushButton_3_clicked();

    void on_pushButton_clicked();

    void on_pushButton_5_clicked();
    void mousePressEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void closeEvent(QCloseEvent *event);

    void on_pushButton_9_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_6_clicked();

    void updateCountdown();

    void entry();
    void out();
    void updateElapsedTime();
    void onButtonClicked();

private:
    QPoint initialMousePosition;
    bool isDragging = false;
    QTimer* entryfirsttimer;
    QTimer *timer;
    QTime elapsedTime;
    enteryandout *e;





private:
    Ui::reserveHome *ui;
public:

public:
    static int getCampusSeat(int index);
    static int getFloorSeat(int index);
    static int getAreaSeat(int index);
    static void importJsonToCampuses(const QString &fileName,campus campuses[]);
    static void saveCampusesToJson(campus campuses[], const QString &fileName);
    static bool booked;

    static campus campuses[4];
    static int index_campus;//校区索引,选择分馆时获取
    static int index_floor;//楼层索引,选择楼层时获取
    static int index_area;//区域索引,选择区域时获取
    static int choice;//选择的seat的索引,结合三个index得到完整的预约信息
    static QString history[];
    static int historyNum;
    static bool isMessageShowAgain;
    static bool isMessageShowAgain2;
    static bool announcementIsHome;
    static bool isReserved;
    static QString reserveTime;
    static bool isToday;
    static QTime enteryTime;
    static bool isEntery;
    static int breaktimes;
    static bool isRemindShowAgain;
};

#endif // RESERVEHOME_H
